﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Chapter02.ViewModel
{
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Markup;

    class CodeOnly : Window
    {
        private Button button1;

        public CodeOnly()
        {
            InitializedComponent();
        }
        private void InitializedComponent()
        {
            Width = Height = 285;
            Left = Top = 100;
            Title = "Code-Only Window";
            DockPanel panel = new DockPanel();
            button1 = new Button { Content = "请单击", Margin = new Thickness(30) };
            button1.Click += button1_Click;
            IAddChild container = panel;
            container.AddChild(button1);
            container = this;
            container.AddChild(panel);
        }

        void button1_Click(object sender, RoutedEventArgs e)
        {
            button1.Content = "谢谢";
        }
    }
}
